home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
toolbar
/
databar
/
books.fm_
/
books.fm
Wrap
Text File
|
1995-11-17
|
9KB
|
303 lines
VERSION 2.00
Begin Form BooksForm
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "Books Table"
ClientHeight = 2388
ClientLeft = 5712
ClientTop = 1704
ClientWidth = 5172
ForeColor = &H00C0C0C0&
Height = 2772
Icon = BOOKS.FRX:0000
Left = 5664
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 2388
ScaleWidth = 5172
Top = 1368
Width = 5268
Begin TextBox PubID
DataField = "PubID"
DataSource = "dBooks"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 7.8
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 288
Left = 3720
TabIndex = 8
Top = 1320
Width = 972
End
Begin TextBox ISBN
DataField = "ISBN"
DataSource = "dBooks"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 7.8
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 288
Left = 1560
TabIndex = 10
Top = 1680
Width = 3132
End
Begin TextBox Au_Id
DataField = "Au_ID"
DataSource = "dBooks"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 7.8
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 288
Left = 1560
TabIndex = 6
Top = 1320
Width = 852
End
Begin PSIDataBar PSIDataBar1
Align = 1 'Align Top
BackColor = &H00C0C0C0&
ButtonCaption = BOOKS.FRX:0302
ButtonChar = BOOKS.FRX:042F
ButtonHeight = 20
ButtonText = BOOKS.FRX:0441
ButtonVisible = BOOKS.FRX:048B
ButtonWidth = 60
CaptionMsg = ""
DataSource = "dBooks"
DialogMsg = "PSIDataBar"
Height = 480
Left = 0
StatusLine = "MDIForm1.StatusLine"
TabIndex = 0
Top = 0
Width = 5175
End
Begin TextBox Title
DataField = "Title"
DataSource = "dBooks"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 7.8
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 288
Left = 1560
TabIndex = 2
Top = 600
Width = 3132
End
Begin TextBox Year_Published
DataField = "Year Published"
DataSource = "dBooks"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 7.8
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 288
Left = 1560
TabIndex = 4
Top = 960
Width = 3132
End
Begin Data dBooks
BackColor = &H00C0C0C0&
Connect = ""
DatabaseName = "C:\VB\BIBLIO.MDB"
Exclusive = 0 'False
Height = 270
Left = 0
Options = 0
ReadOnly = 0 'False
RecordSource = "Titles"
Top = 2160
Width = 5532
End
Begin Label Label5
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackColor = &H8000000F&
BackStyle = 0 'Transparent
Caption = "Publisher ID"
Height = 195
Left = 2520
TabIndex = 7
Top = 1320
Width = 1140
End
Begin Label Label4
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackColor = &H8000000F&
BackStyle = 0 'Transparent
Caption = "ISBN"
Height = 195
Left = 100
TabIndex = 9
Top = 1680
Width = 1400
End
Begin Label Label1
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackColor = &H8000000F&
BackStyle = 0 'Transparent
Caption = "Author ID"
Height = 195
Left = 100
TabIndex = 5
Top = 1320
Width = 1400
End
Begin Label Label3
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackColor = &H8000000F&
BackStyle = 0 'Transparent
Caption = "Title"
Height = 195
Left = 100
TabIndex = 1
Top = 600
Width = 1400
End
Begin Label Label2
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackColor = &H8000000F&
BackStyle = 0 'Transparent
Caption = "Year Published"
Height = 195
Left = 100
TabIndex = 3
Top = 960
Width = 1400
End
End
'
' Copyright ⌐ 1994-1995, Proficient Solutions Inc.
'
' Project: PSIDataBar Sample Application
' Author : mj
' Date : 15 March 1995
'
' File : Form1.Frm
' Purpose: Demonstrates the simple PSIDataBar interface, doesn't
' contain any of the PSIDataBar1_Pre*() functions, but
' does show how to use SetReadOnly and SetReadWrite as
' well as the On events.
'
'
' Programmer's Notes:
'
'
Option Explicit
Const DATA_EDITNONE = 0
Const DATA_EDITMODE = 1
Const DATA_EDITADD = 2
'
' make the data control fit neatly onto the bottom of the form
'
Sub Form_Resize ()
dBooks.Width = Me.ScaleWidth
dBooks.Move 0, Me.ScaleHeight - dBooks.Height
End Sub
Sub PSIDataBar1_OnAddNew (Cancel As Integer)
On Local Error Resume Next
dBooks.Recordset.AddNew
If Err <> 0 Then
MsgBox "Error " + Format$(Err) + " has occured - message is " + Error$, 48, Me.Caption
Cancel = True
End If
End Sub
Sub PSIDataBar1_OnDelete (Cancel As Integer)
If MsgBox("Are you sure that you want to remove this record?", 36, Me.Caption) = 7 Then Cancel = True
If Cancel = True Then Exit Sub
On Local Error Resume Next
dBooks.Recordset.Delete
If Err <> 0 Then
MsgBox "Error " + Format$(Err) + " has occured - message is " + Error$, 48, Me.Caption
Cancel = True
End If
End Sub
Sub PSIDataBar1_OnEdit (Cancel As Integer)
On Local Error Resume Next
dBooks.Recordset.Edit
If Err <> 0 Then
MsgBox "Error " + Format$(Err) + " has occured - message is " + Error$, 48, Me.Caption
Cancel = True
End If
End Sub
Sub PSIDataBar1_OnUpdate (Cancel As Integer)
' see if the user really wants to save the new record.
If dBooks.EditMode = DATA_EDITMODE Then
If MsgBox("Save changes to database?", 36, Me.Caption) = 7 Then Cancel = True
ElseIf dBooks.EditMode = DATA_EDITADD Then
If MsgBox("Save new record to database?", 36, Me.Caption) = 7 Then Cancel = True
End If
If Cancel = True Then Exit Sub
On Local Error Resume Next
dBooks.Recordset.Update
If Err <> 0 Then
MsgBox "Error " + Format$(Err) + " has occured - message is " + Error$, 48, Me.Caption
Cancel = True
End If
End Sub
Sub PSIDataBar1_OnUpdateControls (Cancel As Integer)
On Local Error Resume Next
dBooks.UpdateControls
If Err <> 0 Then
MsgBox "Error " + Format$(Err) + " has occured - message is " + Error$, 48, Me.Caption
Cancel = True
End If
End Sub
Sub PSIDataBar1_SetReadOnly ()
SetEditReadOnly Title
SetEditReadOnly Year_Published
SetEditReadOnly Au_Id
SetEditReadOnly PubId
SetEditReadOnly ISBN
dBooks.Visible = True
End Sub
Sub PSIDataBar1_SetReadWrite ()
SetEditReadWrite Title
SetEditReadWrite Year_Published
SetEditReadWrite Au_Id
SetEditReadWrite PubId
SetEditReadWrite ISBN
dBooks.Visible = False
End Sub